home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / contrib / dvx / inc / x11 / xtos.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-15  |  3.9 KB  |  133 lines

  1. /*
  2. * $XConsortium: Xtos.h,v 1.6 89/12/19 08:23:59 swick Exp $
  3. */
  4.  
  5. /***********************************************************
  6. Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts,
  7. and the Massachusetts Institute of Technology, Cambridge, Massachusetts.
  8.  
  9.                         All Rights Reserved
  10.  
  11. Permission to use, copy, modify, and distribute this software and its 
  12. documentation for any purpose and without fee is hereby granted, 
  13. provided that the above copyright notice appear in all copies and that
  14. both that copyright notice and this permission notice appear in 
  15. supporting documentation, and that the names of Digital or MIT not be
  16. used in advertising or publicity pertaining to distribution of the
  17. software without specific, written prior permission.  
  18.  
  19. DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
  20. ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
  21. DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
  22. ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
  23. WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
  24. ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
  25. SOFTWARE.
  26.  
  27. ******************************************************************/
  28.  
  29. #ifndef _Xtos_h
  30. #define _Xtos_h
  31.  
  32. #ifdef INCLUDE_ALLOCA_H
  33. #include <alloca.h>
  34. #endif
  35.  
  36. #ifdef CRAY
  37. #define WORD64
  38. #define MAXPATHLEN PATH_MAX
  39. #endif
  40.  
  41. #ifndef MSDOS /* POHC 90/09/10 */
  42. #ifdef __HIGHC__
  43. # ifdef MissingStdargH
  44. #  if MissingStdargH
  45. #   define MISSING_STDARG_H
  46. #  endif
  47. # else
  48. #  define MISSING_STDARG_H
  49. # endif
  50.  
  51. # ifdef MISSING_STDARG_H
  52.  
  53. #ifndef _STDARG_H
  54. #define _STDARG_H
  55.  
  56. typedef char *va_list;
  57.  
  58. /* Amount of space required in an argument list for an arg of type TYPE.
  59.    TYPE may alternatively be an expression whose type is used.  */
  60.  
  61. #define __va_rounded_size(TYPE)  \
  62.   (((sizeof (TYPE) + sizeof (int) - 1) / sizeof (int)) * sizeof (int))
  63.  
  64. #define va_start(AP, LASTARG)                                           \
  65.  (AP = ((char *) &(LASTARG) + __va_rounded_size (LASTARG)))
  66.  
  67. #define va_end(AP)
  68.  
  69. #define va_arg(AP, TYPE)                                                \
  70.  (AP += __va_rounded_size (TYPE),                                       \
  71.   *((TYPE *) (AP - __va_rounded_size (TYPE))))
  72.  
  73. #endif /* _STDARG_H */
  74.  
  75. # endif /* MissingStdargH */
  76. #endif /* __HIGHC__ */
  77. #endif /* MSDOS */
  78.  
  79. /* stolen from server/include/os.h */
  80. #ifndef NO_ALLOCA
  81. /*
  82.  * os-dependent definition of local allocation and deallocation
  83.  * If you want something other than XtMalloc/XtFree for ALLOCATE/DEALLOCATE
  84.  * LOCAL then you add that in here.
  85.  */
  86.  
  87. #if defined(__HIGHC__) && !defined(MSDOS)
  88.  
  89. #ifndef MSDOS /* POHC 91/04/01 */
  90. extern char *alloca();
  91. #endif
  92.  
  93. #if HCVERSION < 21003 || HCRELEASE < 2300 /* POHC 90/11/05 */
  94. #define ALLOCATE_LOCAL(size)    alloca((int)(size))
  95. pragma on(alloca);
  96. #else /* HCVERSION >= 21003 */
  97. #define    ALLOCATE_LOCAL(size)    _Alloca((int)(size))
  98. #endif /* HCVERSION < 21003 */
  99.  
  100. #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
  101.  
  102. #endif /* defined(__HIGHC__) */
  103.  
  104.  
  105. #ifdef __GNUC__
  106. #define alloca __builtin_alloca
  107. #define ALLOCATE_LOCAL(size) alloca((int)(size))
  108. #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
  109. #else /* ! __GNUC__ */
  110. /*
  111.  * warning: mips alloca is unsuitable in the server, do not use.
  112.  */
  113. #if defined(vax) || defined(sun)
  114. /*
  115.  * Some System V boxes extract alloca.o from /lib/libPW.a; if you
  116.  * decide that you don't want to use alloca, you might want to fix it here.
  117.  */
  118. char *alloca();
  119. #define ALLOCATE_LOCAL(size) alloca((int)(size))
  120. #define DEALLOCATE_LOCAL(ptr)  /* as nothing */
  121. #endif /* vax or sun */
  122. #endif /* __GNUC__ */
  123.  
  124. #endif /* NO_ALLOCA */
  125.  
  126. #ifndef ALLOCATE_LOCAL
  127. #define ALLOCATE_LOCAL(size) XtMalloc((unsigned long)(size))
  128. #define DEALLOCATE_LOCAL(ptr) XtFree((XtPointer)(ptr))
  129. #endif /* ALLOCATE_LOCAL */
  130.  
  131. #endif /* _Xtos_h */
  132. /* DON'T ADD STUFF AFTER THIS #endif */
  133.